package br.mercadofacil.app.hma;

import com.google.ads.AdRequest;
import com.google.ads.AdView;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;
import android.widget.ImageButton;

public class Lista_Feira extends Activity {

	String Tomate = "";
	String Uva = "";
	String Abacaxi = "";
	String Beringela = "";
	String Abacate = "";
	String Abobrinha = "";
	String Alface = "";
	String Alho = "";
	String Ameixa = "";
	String Banana = "";
	String Batata = "";
	String Beterraba = "";
	String Brocolis = "";
	String Cebola = "";
	String Cenoura = "";
	String Chuchu = "";
	String Espinafre = "";
	String Kiwi = "";
	String Laranja = "";
	String Limao = "";
	String Maca = "";
	String Mamao = "";
	String Manga = "";
	String Manjericao = "";
	String Melancia = "";
	String Pera = "";
	String Pimentao = "";
	
	CheckBox chbTomate, chbUva, chbAbacaxi, chbBeringela, chbAbacate,
			chbAbobrinha, chbAlface, chbAlho, chbAmeixa, chbBanana, chbBatata,
			chbBeterraba, chbBrocolis, chbCebola, chbCenoura, chbChuchu,
			chbEspinafre, chbKiwi, chbLaranja, chbLimao, chbMaca, chbMamao,
			chbManga, chbManjericao, chbMelancia, chbPera, chbPimentao;

	public static final String PREFS_NAME = "SharedPrefsDemoPreferences";
	private SharedPreferences mPrefs;

	private CheckBox CheckBoxTomate, CheckBoxUva, CheckBoxAbacaxi,
			CheckBoxBeringela, CheckBoxAbacate, CheckBoxAbobrinha,
			CheckBoxAlface, CheckBoxAlho, CheckBoxAmeixa, CheckBoxBanana,
			CheckBoxBatata, CheckBoxBeterraba, CheckBoxBrocolis,
			CheckBoxCebola, CheckBoxCenoura, CheckBoxChuchu, CheckBoxEspinafre,
			CheckBoxKiwi, CheckBoxLaranja, CheckBoxLimao, CheckBoxMaca,
			CheckBoxMamao, CheckBoxManga, CheckBoxManjericao, CheckBoxMelancia,
			CheckBoxPera, CheckBoxPimentao;

	public static final String PREF_BOOL13 = "PrefBool13";
	public static final String PREF_BOOL14 = "PrefBool14";
	public static final String PREF_BOOL15 = "PrefBool15";
	public static final String PREF_BOOL16 = "PrefBool16";
	public static final String PREF_BOOL17 = "PrefBool17";
	public static final String PREF_BOOL18 = "PrefBool18";
	public static final String PREF_BOOL19 = "PrefBool19";
	public static final String PREF_BOOL20 = "PrefBool20";
	public static final String PREF_BOOL21 = "PrefBool21";
	public static final String PREF_BOOL22 = "PrefBool22";
	public static final String PREF_BOOL23 = "PrefBool23";
	public static final String PREF_BOOL24 = "PrefBool24";
	public static final String PREF_BOOL25 = "PrefBool25";
	public static final String PREF_BOOL26 = "PrefBoo26";
	public static final String PREF_BOOL27 = "PrefBool27";
	public static final String PREF_BOOL28 = "PrefBool28";
	public static final String PREF_BOOL29 = "PrefBool29";
	public static final String PREF_BOOL30 = "PrefBool30";
	public static final String PREF_BOOL31 = "PrefBool31";
	public static final String PREF_BOOL32 = "PrefBool32";
	public static final String PREF_BOOL33 = "PrefBool33";
	public static final String PREF_BOOL34 = "PrefBool34";
	public static final String PREF_BOOL35 = "PrefBool35";
	public static final String PREF_BOOL36 = "PrefBool36";
	public static final String PREF_BOOL37 = "PrefBool37";
	public static final String PREF_BOOL38 = "PrefBool38";
	public static final String PREF_BOOL39 = "PrefBool39";
	public static final String PREF_BOOL40 = "PrefBool40";

	ImageButton btnPagina3;

	public static Object LevaTomate;
	public static Object LevaUva;
	public static Object LevaAbacaxi;
	public static Object LevaBeringela;
	public static Object LevaAbacate;
	public static Object LevaAbobrinha;
	public static Object LevaAlface;
	public static Object LevaAlho;
	public static Object LevaAmeixa;
	public static Object LevaBanana;
	public static Object LevaBatata;
	public static Object LevaBeterraba;
	public static Object LevaBrocolis;
	public static Object LevaCebola;
	public static Object LevaCenoura;
	public static Object LevaChuchu;
	public static Object LevaEspinafre;
	public static Object LevaKiwi;
	public static Object LevaLaranja;
	public static Object LevaLimao;
	public static Object LevaMaca;
	public static Object LevaMamao;
	public static Object LevaManga;
	public static Object LevaManjericao;
	public static Object LevaMelancia;
	public static Object LevaPera;
	public static Object LevaPimentao;
	

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.aba_feira);
		
		AdView adView1 = (AdView)this.findViewById(R.id.adView1);  
		adView1.loadAd(new AdRequest()); 

		mPrefs = getSharedPreferences(PREFS_NAME, 0);

		CheckBoxTomate = (CheckBox) findViewById(R.id.checkBoxTomate);
		chbTomate = (CheckBox) findViewById(R.id.checkBoxTomate);
		CheckBoxUva = (CheckBox) findViewById(R.id.checkBoxUva);
		chbUva = (CheckBox) findViewById(R.id.checkBoxUva);
		CheckBoxAbacaxi = (CheckBox) findViewById(R.id.checkBoxAbacaxi);
		chbAbacaxi = (CheckBox) findViewById(R.id.checkBoxAbacaxi);
		CheckBoxBeringela = (CheckBox) findViewById(R.id.checkBoxBeringela);
		chbBeringela = (CheckBox) findViewById(R.id.checkBoxBeringela);
		CheckBoxAbacate = (CheckBox) findViewById(R.id.checkBoxAbacate);
		chbAbacate = (CheckBox) findViewById(R.id.checkBoxAbacate);
		CheckBoxAbobrinha = (CheckBox) findViewById(R.id.checkBoxAbobrinha);
		chbAbobrinha = (CheckBox) findViewById(R.id.checkBoxAbobrinha);
		CheckBoxAlface = (CheckBox) findViewById(R.id.checkBoxAlface);
		chbAlface = (CheckBox) findViewById(R.id.checkBoxAlface);
		CheckBoxAlho = (CheckBox) findViewById(R.id.checkBoxAlho);
		chbAlho = (CheckBox) findViewById(R.id.checkBoxAlho);
		CheckBoxAmeixa = (CheckBox) findViewById(R.id.checkBoxAmeixa);
		chbAmeixa = (CheckBox) findViewById(R.id.checkBoxAmeixa);
		CheckBoxBanana = (CheckBox) findViewById(R.id.checkBoxBanana);
		chbBanana = (CheckBox) findViewById(R.id.checkBoxBanana);
		CheckBoxBatata = (CheckBox) findViewById(R.id.checkBoxBatata);
		chbBatata = (CheckBox) findViewById(R.id.checkBoxBatata);
		CheckBoxBeterraba = (CheckBox) findViewById(R.id.checkBoxBeterraba);
		chbBeterraba = (CheckBox) findViewById(R.id.checkBoxBeterraba);
		CheckBoxBrocolis = (CheckBox) findViewById(R.id.checkBoxBrocolis);
		chbBrocolis = (CheckBox) findViewById(R.id.checkBoxBrocolis);
		CheckBoxCebola = (CheckBox) findViewById(R.id.checkBoxCebola);
		chbCebola = (CheckBox) findViewById(R.id.checkBoxCebola);
		CheckBoxCenoura = (CheckBox) findViewById(R.id.checkBoxCenoura);
		chbCenoura = (CheckBox) findViewById(R.id.checkBoxCenoura);
		CheckBoxChuchu = (CheckBox) findViewById(R.id.checkBoxChuchu);
		chbChuchu = (CheckBox) findViewById(R.id.checkBoxChuchu);
		CheckBoxEspinafre = (CheckBox) findViewById(R.id.checkBoxEspinafre);
		chbEspinafre = (CheckBox) findViewById(R.id.checkBoxEspinafre);
		CheckBoxKiwi = (CheckBox) findViewById(R.id.checkBoxKiwi);
		chbKiwi = (CheckBox) findViewById(R.id.checkBoxKiwi);
		CheckBoxLaranja = (CheckBox) findViewById(R.id.checkBoxLaranja);
		chbLaranja = (CheckBox) findViewById(R.id.checkBoxLaranja);
		CheckBoxLimao = (CheckBox) findViewById(R.id.checkBoxLimao);
		chbLimao = (CheckBox) findViewById(R.id.checkBoxLimao);
		CheckBoxMaca = (CheckBox) findViewById(R.id.checkBoxMaca);
		chbMaca = (CheckBox) findViewById(R.id.checkBoxMaca);
		CheckBoxMamao = (CheckBox) findViewById(R.id.checkBoxMamao);
		chbMamao = (CheckBox) findViewById(R.id.checkBoxMamao);
		CheckBoxManga = (CheckBox) findViewById(R.id.checkBoxManga);
		chbManga = (CheckBox) findViewById(R.id.checkBoxManga);
		CheckBoxManjericao = (CheckBox) findViewById(R.id.checkBoxManjericao);
		chbManjericao = (CheckBox) findViewById(R.id.checkBoxManjericao);
		CheckBoxMelancia = (CheckBox) findViewById(R.id.checkBoxMelancia);
		chbMelancia = (CheckBox) findViewById(R.id.checkBoxMelancia);
		CheckBoxPera = (CheckBox) findViewById(R.id.checkBoxPera);
		chbPera = (CheckBox) findViewById(R.id.checkBoxPera);
		CheckBoxPimentao = (CheckBox) findViewById(R.id.checkBoxPimentao);
		chbPimentao = (CheckBox) findViewById(R.id.checkBoxPimentao);
		

		btnPagina3 = (ImageButton) findViewById(R.id.btnPagina3);

		btnPagina3.setOnClickListener(new View.OnClickListener() {

			
			public void onClick(View v) {
				// TODO Auto-generated method stub

				if (chbTomate.isChecked()) {
					Tomate = "Tomate";
				}
				if (chbUva.isChecked()) {
					Uva = "Uva";
				}
				if (chbAbacaxi.isChecked()) {
					Abacaxi = "Abacaxi";
				}
				if (chbBeringela.isChecked()) {
					Beringela = "Beringela";
				}
				if (chbAbacate.isChecked()) {
					Abacate = "Abacate";
				}
				if (chbAbobrinha.isChecked()) {
					Abobrinha = "Abobrinha";
				}
				if (chbAlface.isChecked()) {
					Alface = "Alface";
				}
				if (chbAlho.isChecked()) {
					Alho = "Alho";
				}
				if (chbAmeixa.isChecked()) {
					Ameixa = "Ameixa";
				}
				if (chbBanana.isChecked()) {
					Banana = "Banana";
				}
				if (chbBatata.isChecked()) {
					Batata = "Batata";
				}
				if (chbBeterraba.isChecked()) {
					Beterraba = "Beterraba";
				}
				if (chbBrocolis.isChecked()) {
					Brocolis = "Brocolis";
				}
				if (chbCebola.isChecked()) {
					Cebola = "Cebola";
				}
				if (chbCenoura.isChecked()) {
					Cenoura = "Cenoura";
				}
				if (chbChuchu.isChecked()) {
					Chuchu = "Chuchu";
				}
				if (chbEspinafre.isChecked()) {
					Espinafre = "Espinafre";
				}
				if (chbKiwi.isChecked()) {
					Kiwi = "Kiwi";
				}
				if (chbLaranja.isChecked()) {
					Laranja = "Laranja";
				}
				if (chbLimao.isChecked()) {
					Limao = "Lim‹o";
				}
				if (chbMaca.isChecked()) {
					Maca = "Ma�a";
				}
				if (chbManga.isChecked()) {
					Manga = "Manga";
				}
				if (chbMamao.isChecked()) {
					Mamao = "Mam‹o";
				}
				if (chbManjericao.isChecked()) {
					Manjericao = "Manjericao";
				}
				if (chbMelancia.isChecked()) {
					Melancia = "Melancia";
				}
				if (chbPera.isChecked()) {
					Pera = "Pera";
				}
				if (chbPimentao.isChecked()) {
					Pimentao = "Piment‹o";
				}
				

				LevaAbacate = Abacate;
				LevaAbacaxi = Abacaxi;
				LevaAbobrinha = Abobrinha;
				LevaAlface = Alface;
				LevaAlho = Alho;
				LevaAmeixa = Ameixa;
				LevaBanana = Banana;
				LevaBatata = Batata;
				LevaBeringela = Beringela;
				LevaBeterraba = Beterraba;
				LevaBrocolis = Brocolis;
				LevaCebola = Cebola;
				LevaCenoura = Cenoura;
				LevaChuchu = Chuchu;
				LevaEspinafre = Espinafre;
				LevaKiwi = Kiwi;
				LevaLaranja = Laranja;
				LevaLimao = Limao;
				LevaMaca = Maca;
				LevaMamao = Mamao;
				LevaManga = Manga;
				LevaManjericao = Manjericao;
				LevaMelancia = Melancia;
				LevaPera = Pera;
				LevaPimentao = Pimentao;
				LevaTomate = Tomate;
				LevaUva = Uva;

				startActivity(new Intent(Lista_Feira.this, Lista_Higiene.class));

			}
		});

	}

	@Override
	protected void onResume() {
		
		CheckBoxAbacate.setChecked(mPrefs.getBoolean(PREF_BOOL13, false));
		CheckBoxAbacaxi.setChecked(mPrefs.getBoolean(PREF_BOOL14, false));
		CheckBoxAbobrinha.setChecked(mPrefs.getBoolean(PREF_BOOL15, false));
		CheckBoxAlface.setChecked(mPrefs.getBoolean(PREF_BOOL16, false));
		CheckBoxAlho.setChecked(mPrefs.getBoolean(PREF_BOOL17, false));
		CheckBoxAmeixa.setChecked(mPrefs.getBoolean(PREF_BOOL18, false));
		CheckBoxBanana.setChecked(mPrefs.getBoolean(PREF_BOOL19, false));
		CheckBoxBatata.setChecked(mPrefs.getBoolean(PREF_BOOL20, false));
		CheckBoxBeringela.setChecked(mPrefs.getBoolean(PREF_BOOL21, false));
		CheckBoxBeterraba.setChecked(mPrefs.getBoolean(PREF_BOOL22, false));
		CheckBoxBrocolis.setChecked(mPrefs.getBoolean(PREF_BOOL23, false));
		CheckBoxCebola.setChecked(mPrefs.getBoolean(PREF_BOOL24, false));
		CheckBoxCenoura.setChecked(mPrefs.getBoolean(PREF_BOOL25, false));
		CheckBoxChuchu.setChecked(mPrefs.getBoolean(PREF_BOOL26, false));
		CheckBoxEspinafre.setChecked(mPrefs.getBoolean(PREF_BOOL27, false));
		CheckBoxKiwi.setChecked(mPrefs.getBoolean(PREF_BOOL28, false));
		CheckBoxLaranja.setChecked(mPrefs.getBoolean(PREF_BOOL29, false));
		CheckBoxLimao.setChecked(mPrefs.getBoolean(PREF_BOOL30, false));
		CheckBoxMaca.setChecked(mPrefs.getBoolean(PREF_BOOL31, false));
		CheckBoxMamao.setChecked(mPrefs.getBoolean(PREF_BOOL32, false));
		CheckBoxManga.setChecked(mPrefs.getBoolean(PREF_BOOL33, false));
		CheckBoxManjericao.setChecked(mPrefs.getBoolean(PREF_BOOL34, false));
		CheckBoxMelancia.setChecked(mPrefs.getBoolean(PREF_BOOL35, false));
		CheckBoxPera.setChecked(mPrefs.getBoolean(PREF_BOOL36, false));
		CheckBoxPimentao.setChecked(mPrefs.getBoolean(PREF_BOOL37, false));
		CheckBoxTomate.setChecked(mPrefs.getBoolean(PREF_BOOL39, false));
		CheckBoxUva.setChecked(mPrefs.getBoolean(PREF_BOOL40, false));

		super.onResume();
	}

	@Override
	protected void onPause() {
		Editor e = mPrefs.edit();
		e.putBoolean(PREF_BOOL13, CheckBoxAbacate.isChecked());
		e.putBoolean(PREF_BOOL14, CheckBoxAbacaxi.isChecked());
		e.putBoolean(PREF_BOOL15, CheckBoxAbobrinha.isChecked());
		e.putBoolean(PREF_BOOL16, CheckBoxAlface.isChecked());
		e.putBoolean(PREF_BOOL17, CheckBoxAlho.isChecked());
		e.putBoolean(PREF_BOOL18, CheckBoxAmeixa.isChecked());
		e.putBoolean(PREF_BOOL19, CheckBoxBanana.isChecked());
		e.putBoolean(PREF_BOOL20, CheckBoxBatata.isChecked());
		e.putBoolean(PREF_BOOL21, CheckBoxBeringela.isChecked());
		e.putBoolean(PREF_BOOL22, CheckBoxBeterraba.isChecked());
		e.putBoolean(PREF_BOOL23, CheckBoxBrocolis.isChecked());
		e.putBoolean(PREF_BOOL24, CheckBoxCebola.isChecked());
		e.putBoolean(PREF_BOOL25, CheckBoxCenoura.isChecked());
		e.putBoolean(PREF_BOOL26, CheckBoxChuchu.isChecked());
		e.putBoolean(PREF_BOOL27, CheckBoxEspinafre.isChecked());
		e.putBoolean(PREF_BOOL28, CheckBoxKiwi.isChecked());
		e.putBoolean(PREF_BOOL29, CheckBoxLaranja.isChecked());
		e.putBoolean(PREF_BOOL30, CheckBoxLimao.isChecked());
		e.putBoolean(PREF_BOOL31, CheckBoxMaca.isChecked());
		e.putBoolean(PREF_BOOL32, CheckBoxMamao.isChecked());
		e.putBoolean(PREF_BOOL33, CheckBoxManga.isChecked());
		e.putBoolean(PREF_BOOL34, CheckBoxManjericao.isChecked());
		e.putBoolean(PREF_BOOL35, CheckBoxMelancia.isChecked());
		e.putBoolean(PREF_BOOL36, CheckBoxPera.isChecked());
		e.putBoolean(PREF_BOOL37, CheckBoxPimentao.isChecked());
		e.putBoolean(PREF_BOOL39, CheckBoxTomate.isChecked());
		e.putBoolean(PREF_BOOL40, CheckBoxUva.isChecked());

		e.commit();
		super.onPause();
	}
}